package br.edu.senai.controller;

import com.mysql.jdbc.Connection;
import java.sql.DriverManager;

/**
 * @author william.chenta
 */
public class ConexaoJDBC {
    private String driver = "com.mysql.jdbc.Driver";
    private final String URL = "jdbc:mysql://localhost/lanchonete";
    private final String USER = "root";
    private final String SENHA = "";
    private Connection conn;

    public ConexaoJDBC() {
        try {
            Class.forName(driver);
            conn = (Connection) DriverManager.getConnection(URL, USER, SENHA);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public Connection getConn() {
        return conn;
    }
    
    public void fecharConexaoJDBC() {
        try {
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
